package com.gitee.liuzhi.demo.juc.thread;

/**
 * @Author liuzhi
 * @Date 2023/9/6 20:39
 * @Version 1.0
 * @Description
 */
public class RunnableDemo {

    public static void main(String[] args) {
        for (int i = 0; i < 100; i++) {
            // 3.创建MyRunnable的实例, 并通过Thread启动, Thread才是真正的线程对象
            new Thread(new MyRunnable()).start();
        }
    }

    /**
     * 1.定义Runnable的实现类MyRunnable
     */
    static class MyRunnable implements Runnable {
        // 2.重写run方法
        @Override
        public void run() {
            System.out.println(Thread.currentThread() + " : start");
        }
    }

}
